package com.carsystem.controller;


import com.carsystem.entity.Shop;
import com.carsystem.service.IShopService;
import com.carsystem.utils.PageResult;
import com.carsystem.utils.QueryPageBean;
import com.carsystem.utils.Result;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ykl
 * @since 2021-12-04
 */
@RestController
@RequestMapping("/shop")
public class ShopController {
    @Reference
    private IShopService shopService;

    @RequestMapping("/findPage")
    public PageResult findPage(@RequestBody QueryPageBean queryPageBean){

        PageResult page = shopService.findPage(queryPageBean);
        return page;
    }
    @RequestMapping("/addShop")
    public Result addShop(@RequestBody Shop shop){
        return shopService.addShop(shop);
    }
    @RequestMapping("/updateShop")
    public Result updateShop(@RequestBody Shop shop){
        return shopService.updateShop(shop);
    }
    @RequestMapping("/deleteShop/{shopId}")
    public Result deleteShop(@PathVariable int shopId){
        return shopService.deleteShop(shopId);
    }
    @RequestMapping("/findAllShop")
    public Result findAllShop(){
        return  shopService.findAllShop();
    }

}

